﻿using System;
using System.Windows.Forms;
using MyEncrypt;
namespace MyLock
{
    public partial class Form1 : Form
    {

        IEncrypter encrypter;
        Decrypter decrypter;

        public Form1(IEncrypter _encrypter, Decrypter _decrypter)
        {
            encrypter = _encrypter;
            decrypter = _decrypter;
            InitializeComponent();
            skinEngine1.SkinFile = Application.StartupPath + "\\Skins\\SteelBlack.ssk";
        }


        private void Panel1_DragDrop(object sender, DragEventArgs e)
        {
            string path = ((System.Array)e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();       //获得路径
            encrypter.SingleEncrypt(path);
        }

        private void Panel1_DragEnter(object sender, DragEventArgs e)
        {
           
            if (e.Data.GetDataPresent(DataFormats.FileDrop))
                e.Effect = DragDropEffects.All;
            else
                e.Effect = DragDropEffects.None;
        }

        private void Button1_Click(object sender, EventArgs e)
        {
                
            if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) {
               string path=folderBrowserDialog1.SelectedPath;
                encrypter.SingleEncrypt(path);
            }
        }

        private void Button2_Click(object sender, EventArgs e)
        {
            if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
            {
                string path = folderBrowserDialog1.SelectedPath;
                encrypter.MultiEncrypt(path);
            }
        }

        private void  Button3_Click(object sender, EventArgs e)
        {

            if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
            {
                string path = folderBrowserDialog1.SelectedPath;
                decrypter.MultiDecrypt(path);
            }
        }

    }
}
